package com.example.hanchen.yongkanggy.home.adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.example.hanchen.yongkanggy.home.fragment.ControlitemFragment;
import com.example.hanchen.yongkanggy.home.fragment.WarnitemFragment;

import java.util.List;

public class ControItemAdapter extends FragmentPagerAdapter {

    private List<Fragment> fragmentList;
    private List<String> tabList;

    public ControItemAdapter(FragmentManager fm, List<Fragment> frameLayoutList, List<String> tabLayoutList) {
        super(fm);
        this.fragmentList = frameLayoutList;
        this.tabList = tabLayoutList;
    }

    @Override
    public Fragment getItem(int position) {
        return ControlitemFragment.newInstance(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabList.get(position);
    }
}